package com.niit.service.impl;

import com.niit.dao.ILeave_messageDao;
import com.niit.dao.impl.Leave_messageDaoImpl;
import com.niit.domain.Leave_message;
import com.niit.service.ILeave_messageService;

import java.time.LocalDate;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.util.Date;

public class Leave_messageService implements ILeave_messageService {
    @Override
    public int InsertLeaveMessage(Leave_message leave_message) {
        ILeave_messageDao iLeave_messageDao = new Leave_messageDaoImpl();
        ZoneId zoneId = ZoneId.systemDefault();
        LocalDate localDate = LocalDate.now();
        ZonedDateTime zdt = localDate.atStartOfDay(zoneId);

        Date date = Date.from(zdt.toInstant());
        System.out.println(date);
        leave_message.setLtime(date);
        leave_message.setLtime(date);
        int i = iLeave_messageDao.insertMessageDao(leave_message);

        return i;
    }
}
